package com.hw.core.system.controller;

import com.hw.core.system.entity.Course;
import com.hw.core.system.entity.CourseReview;
import com.hw.core.system.entity.CourseType;
import com.hw.core.system.entity.NoteBook;
import com.hw.core.system.service.CourseReviewService;
import com.hw.core.system.service.CourseService;
import com.hw.core.system.service.CourseTypeService;
import com.hw.core.system.service.NoteBookService;
import com.hw.core.util.UuidUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("courseReview")
public class CourseReviewController {
    private static final Logger logger = LoggerFactory.getLogger( CourseReviewController.class );

    @Autowired
    private CourseReviewService courseReviewService;

    @RequiresPermissions(value = "评论查询")
    @GetMapping("/")
    public String list(Model model) {
        model.addAttribute( "courseReviews", courseReviewService.findAllCourseReview() );
        return "courseReview/listCourseReview";
    }

    @RequiresPermissions(value = "评论删除")
    @PostMapping("delete")
    @ResponseBody
    public String delete(Integer id) {
        courseReviewService.delete( id );
        return "删除成功";
    }


}
